package com.d3works.apps.base.service.filesourceconnector.models;

import com.d3works.apps.base.db.FileSourceConnector;
import com.d3works.apps.base.db.FileSourceConnectorParameters;
import com.d3works.exception.D3worksException;
import com.d3works.meta.db.MetaFile;
import java.util.List;

public interface FileTransfertSession {

  /**
   * Methods that checks if the session is valid. Mostly done by checking if we can connect to the
   * host configured.
   *
   * @return true if valid, else false
   * @throws D3worksException
   */
  boolean isValid() throws D3worksException;

  /**
   * Upload files to host configured in parameters. The session must be configured and connected
   * before calling this method.
   *
   * @param parameters
   * @param files
   * @throws D3worksException
   */
  void upload(FileSourceConnectorParameters parameters, List<MetaFile> files)
      throws D3worksException;

  /**
   * Download files from host configured in parameters. The session must be configured and connected
   * before calling this method.
   *
   * @param parameters
   * @param files
   * @return List of {@link MetaFile}
   * @throws D3worksException
   */
  List<MetaFile> download(FileSourceConnectorParameters parameter) throws D3worksException;

  /**
   * Method to configure a session by using the fileSourceConnector
   *
   * @param fileSourceConnector
   * @return the configured session
   * @throws D3worksException
   */
  FileTransfertSession configureSession(FileSourceConnector fileSourceConnector)
      throws D3worksException;

  /**
   * Disconnect the session
   *
   * @throws D3worksException
   */
  void disconnect() throws D3worksException;

  /**
   * Connect the session
   *
   * @throws D3worksException
   */
  void connect() throws D3worksException;
}
